package com.test.system.admin.controller;

import com.test.system.admin.pojo.TableData;
import com.test.system.admin.pojo.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.ArrayList;
import java.util.List;

/**
 * @author 徒有琴
 */
@RequestMapping("table.html")
@Controller
public class TableController {
    @RequestMapping
    public String table() {
        return "table";
    }

    @RequestMapping(params = "act=data")
    @ResponseBody
    public TableData data() {
        TableData tableData = new TableData();
        List<User> list = new ArrayList();
        list.add(new User(1, "宝哥", "bao@1901.com"));
        list.add(new User(2, "爽哥", "shuang@1901.com"));
        list.add(new User(3, "学森", "sen@1901.com"));
        tableData.setData(list);
        tableData.setCount(3);
        return tableData;
    }
    @RequestMapping(params = "act=update")
    @ResponseBody
    public String update(User user){
        System.out.println(user.getEmail());
        return "ok";
    }
}
